<template>
  <el-collapse v-model="activeNames" class="Fg-collapse" v-on="$listeners" :style="newStyle">
    <el-collapse-item
      class="Fg-tips"
      v-for="item in list"
      :key="item.value"
      :name="item.value"
      :title="item.label"
    >
      <form-row-container
        :list.sync="item.children"
        :font="newStyle.font"
        v-bind="$attrs"
        :border="false"
      />
    </el-collapse-item>
  </el-collapse>
</template>
 
<script>
import { deepClone, toCamelCase } from "../../../utils/index";
import { comMixin } from "../../../utils/comMixins";
export default {
  mixins: [comMixin],
  name: "form-collapse",
  props: {
    value: {
      type: [String, Number],
      default: "",
    },
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      activeNames: [],
      deepClone,
      toCamelCase,
    };
  },
  watch: {
    value: {
      immediate: true,
      deep: true,
      handler(newValue, oldValue) {
        try {
          this.activeNames = newValue.split(",");
        } catch (error) {
          console.log(error);
        }
      },
    },
  },
};
</script>

<style lang="scss" >
@import "../../../styles/generator.scss";
.Fg-collapse {
  color: #303133;
  font-size: 13px;
  font-weight: 500;
  .el-collapse-item__content {
    padding-bottom: 0;
  }
  .el-collapse-item__header {
    background: transparent;
    font-size: inherit;
    color: inherit;
    font-weight: inherit;
  }
}
</style>